﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace Ele21RHelp
{
    /// <summary>
    /// 预言.xaml 的交互逻辑
    /// </summary>
    public partial class 预言 : Window
    {
        ViewMode.预言 data;
        TextBox lastSelectBox;
        public 预言()
        {
            InitializeComponent();
            data=  this.DataContext as ViewMode.预言;
            lastSelectBox = input1;
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Button bt=sender as Button;
            if (lastSelectBox.Name==nameof(input1))
            {
                data.value1 += bt.DataContext.ToString();
            }
            if (lastSelectBox.Name == nameof(input2))
            {
                data.value2 += bt.DataContext.ToString();
            }
            if (lastSelectBox.Name == nameof(input3))
            {
                data.value3 += bt.DataContext.ToString();
            }
            if (lastSelectBox.Name == nameof(input4))
            {
                data.value4 += bt.DataContext.ToString();
            }
            Keyboard.Focus(lastSelectBox);
        }

        private void input1_LostFocus(object sender, RoutedEventArgs e)
        {
            lastSelectBox = sender as TextBox;
        }
    }
}
